#include <stdio.h>
#include <stdlib.h>
#include <time.h>
using namespace std;

const int k = 32;
const int numberOfTests = 1000;
const int numberOfSamples = 10000;

int main(int argc, char *argv[])
{
    unsigned int timeValue = time(NULL);
    char buffer[100];

    srand(time(NULL));

	for(int i = 0 ; i < numberOfTests ; ++i) {
	    srand(timeValue + i);
        
        sprintf(buffer, "./tests/%d.txt", i);
        
        int j,k;
	    
	    FILE *pFile = fopen (buffer, "w");
        if (pFile!=NULL) {
            j = (rand() % 10000)+1;
            k = (rand() % 20000)+1;
            
            if (j == k)
                k++;
            
            if (j < k)
                fprintf(pFile, "%d %d\n", j, k);
            else
                fprintf(pFile, "%d %d\n", k, j);
        
            fclose (pFile);
        }
	}
	
	// Wygenerowanie skryptu testującego
	FILE *pFile = fopen ("./testskrypt.sh", "w");
    if (pFile!=NULL) {
        //fprintf(pFile, "g++ Tausworth.cpp -o Tausworth\n");
        for(int i = 0 ; i < numberOfTests ; ++i) {
            fprintf(pFile, "./fibxor 1-%d < ./tests/%d.txt > ./out/%d.txt\n", numberOfSamples, i, i);
        }
        for(int i = 0 ; i < numberOfTests ; ++i) {
            fprintf(pFile, "./StatystykiTestowe 32 < ./out/%d.txt > ./stats/%d.txt\n", i, i);
        }
        fclose (pFile);
    }

	return 0;
}
